import string
import re

keys = string.digits + '+/' + string.ascii_lowercase + string.ascii_uppercase


def encrypt(code):
    st = re.findall('.{3}', code)
    st.append(code[(len(st) * 3):])
    bins = ''
    for s in st:
        for i in s:
            bins += bin(ord(i)).replace('0b', '').rjust(8, '0')
    bt = re.findall('.{6}', bins)
    bt.append(bins[(len(bt) * 6):])
    res = ''
    for b in bt:
        res += keys[int(b.ljust(6, '0'), 2)]
    res += '=' * (4 - (len(bt) % 4))
    return res


encrypt("flag{********************************}") == "nALvnRGRmhqLbQ4Tnx4MaAeRchrvmAaRc38Pnxzyah5vmhiNmlO"
